/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JDialogConclusion.java
 *
 * Created on 28/04/2011, 01:00:51
 */

package systole.view.tabs.results.conclusion;

import org.jdesktop.application.Action;

/**
 *
 * @author jmj
 */
public class JDialogConclusion extends javax.swing.JDialog {

    private ControllerConclusion controller;

    /** Creates new form JDialogConclusion */
    public JDialogConclusion(java.awt.Frame parent, ControllerConclusion controller) {
        super(parent, true);
        initComponents();
        this.controller = controller;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLblTemplates = new javax.swing.JLabel();
        jCmbConclusions = new javax.swing.JComboBox();
        jBtnNewConclusion = new javax.swing.JButton();
        jBtnSearchConclusion = new javax.swing.JButton();
        jBtnAddConclusion = new javax.swing.JButton();
        jBtnClear = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTxtConclusion = new javax.swing.JTextArea();
        jBtnCancel = new javax.swing.JButton();
        jBtnOk = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getResourceMap(JDialogConclusion.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setModal(true);
        setName("Form"); // NOI18N
        setResizable(false);

        jLblTemplates.setText(resourceMap.getString("jLblTemplates.text")); // NOI18N
        jLblTemplates.setName("jLblTemplates"); // NOI18N

        jCmbConclusions.setEditable(true);
        jCmbConclusions.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jCmbConclusions.setToolTipText(resourceMap.getString("jCmbConclusions.toolTipText")); // NOI18N
        jCmbConclusions.setName("jCmbConclusions"); // NOI18N

        jBtnNewConclusion.setIcon(resourceMap.getIcon("jBtnNewConclusion.icon")); // NOI18N
        jBtnNewConclusion.setToolTipText(resourceMap.getString("jBtnNewConclusion.toolTipText")); // NOI18N
        jBtnNewConclusion.setMaximumSize(new java.awt.Dimension(28, 28));
        jBtnNewConclusion.setMinimumSize(new java.awt.Dimension(28, 28));
        jBtnNewConclusion.setName("jBtnNewConclusion"); // NOI18N
        jBtnNewConclusion.setPreferredSize(new java.awt.Dimension(28, 28));
        jBtnNewConclusion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnNewConclusionActionPerformed(evt);
            }
        });

        jBtnSearchConclusion.setIcon(resourceMap.getIcon("jBtnSearchConclusion.icon")); // NOI18N
        jBtnSearchConclusion.setToolTipText(resourceMap.getString("jBtnSearchConclusion.toolTipText")); // NOI18N
        jBtnSearchConclusion.setMaximumSize(new java.awt.Dimension(28, 28));
        jBtnSearchConclusion.setMinimumSize(new java.awt.Dimension(28, 28));
        jBtnSearchConclusion.setName("jBtnSearchConclusion"); // NOI18N
        jBtnSearchConclusion.setPreferredSize(new java.awt.Dimension(28, 28));
        jBtnSearchConclusion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnSearchConclusionActionPerformed(evt);
            }
        });

        jBtnAddConclusion.setText(resourceMap.getString("jBtnAddConclusion.text")); // NOI18N
        jBtnAddConclusion.setToolTipText(resourceMap.getString("jBtnAddConclusion.toolTipText")); // NOI18N
        jBtnAddConclusion.setName("jBtnAddConclusion"); // NOI18N
        jBtnAddConclusion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnAddConclusionActionPerformed(evt);
            }
        });

        jBtnClear.setText(resourceMap.getString("jBtnClear.text")); // NOI18N
        jBtnClear.setToolTipText(resourceMap.getString("jBtnClear.toolTipText")); // NOI18N
        jBtnClear.setName("jBtnClear"); // NOI18N
        jBtnClear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnClearActionPerformed(evt);
            }
        });

        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTxtConclusion.setColumns(10);
        jTxtConclusion.setLineWrap(true);
        jTxtConclusion.setRows(5);
        jTxtConclusion.setWrapStyleWord(true);
        jTxtConclusion.setName("jTxtConclusion"); // NOI18N
        jScrollPane1.setViewportView(jTxtConclusion);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getActionMap(JDialogConclusion.class, this);
        jBtnCancel.setAction(actionMap.get("cancel")); // NOI18N
        jBtnCancel.setText(resourceMap.getString("jBtnCancel.text")); // NOI18N
        jBtnCancel.setName("jBtnCancel"); // NOI18N

        jBtnOk.setAction(actionMap.get("ok")); // NOI18N
        jBtnOk.setText(resourceMap.getString("jBtnOk.text")); // NOI18N
        jBtnOk.setName("jBtnOk"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLblTemplates)
                        .addGap(12, 12, 12)
                        .addComponent(jCmbConclusions, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBtnAddConclusion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 98, Short.MAX_VALUE)
                        .addComponent(jBtnSearchConclusion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBtnNewConclusion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jBtnClear, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 280, Short.MAX_VALUE)
                        .addComponent(jBtnOk)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jBtnCancel)))
                .addContainerGap())
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jBtnAddConclusion, jBtnClear});

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jBtnNewConclusion, jBtnSearchConclusion});

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jBtnCancel, jBtnOk});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLblTemplates)
                    .addComponent(jCmbConclusions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtnAddConclusion)
                    .addComponent(jBtnSearchConclusion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtnNewConclusion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtnCancel)
                    .addComponent(jBtnOk)
                    .addComponent(jBtnClear))
                .addContainerGap())
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jBtnAddConclusion, jBtnClear});

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jBtnNewConclusion, jBtnSearchConclusion});

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jBtnCancel, jBtnOk});

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBtnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnClearActionPerformed
        this.getjTxtConclusion().setText("");
}//GEN-LAST:event_jBtnClearActionPerformed

    private void jBtnNewConclusionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnNewConclusionActionPerformed
        this.controller.newConclusion();
    }//GEN-LAST:event_jBtnNewConclusionActionPerformed

    private void jBtnSearchConclusionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSearchConclusionActionPerformed
       this.controller.search();
    }//GEN-LAST:event_jBtnSearchConclusionActionPerformed

    private void jBtnAddConclusionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnAddConclusionActionPerformed
      this.controller.add();
    }//GEN-LAST:event_jBtnAddConclusionActionPerformed

    @Action
    public void ok() {
        this.controller.ok();
    }

    @Action
    public void cancel() {
        this.controller.cancel();
    }

  

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtnAddConclusion;
    private javax.swing.JButton jBtnCancel;
    private javax.swing.JButton jBtnClear;
    private javax.swing.JButton jBtnNewConclusion;
    private javax.swing.JButton jBtnOk;
    private javax.swing.JButton jBtnSearchConclusion;
    private javax.swing.JComboBox jCmbConclusions;
    private javax.swing.JLabel jLblTemplates;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTxtConclusion;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the jCmbConclusions
     */
    public javax.swing.JComboBox getjCmbConclusions() {
        return jCmbConclusions;
    }

    /**
     * @return the jTxtConclusion
     */
    public javax.swing.JTextArea getjTxtConclusion() {
        return jTxtConclusion;
    }

    @Action
    public void newConclusion() {
        this.controller.newConclusion();
    }

    @Action
    public void search() {
        this.controller.search();
    }

    @Action
    public void addConclusion() {
        this.controller.add();
    }


    

}
